package org.japo.java.matisse.samples;

import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

public class PanelFondo extends JPanel {

    private Image imagen;

    public PanelFondo() {
        imagen = new ImageIcon().getImage();
    }

    public PanelFondo(Image imagen) {
        if (imagen != null) {
            this.imagen = imagen;
        }
    }

    @Override
    public void paint(Graphics g) {
        g.drawImage(getImagen(), 0, 0, getWidth(), getHeight(), this);
        setOpaque(false);
        super.paint(g);
    }

    public Image getImagen() {
        return imagen;
    }

    public void setImagen(Image imagen) {
        this.imagen = imagen;
    }
}
